home *** CD-ROM | disk | FTP | other *** search
/ Ultra Gameplayers 101 / Ultra Game Players Magazine, No. 101 - September 1997 (Imagine Publishing, Inc.)(1997).iso / pc / new_ugp.dxr / 00215_Demo Button Class.ls < prev    next >
Encoding:
Text File  |  1997-07-10  |  1.7 KB  |  73 lines

  1. property currentDemo, currentURL, launchButton, killList
  2.  
  3. on new me, parameterList
  4.   set killList to []
  5.   set launchButton to getaProp(parameterList, #launchButton)
  6.   if launchButton > 0 then
  7.     set the visible of sprite launchButton to 0
  8.   end if
  9.   set currentDemo to 0
  10.   set currentURL to 0
  11.   return me
  12. end
  13.  
  14. on init me, newDemo, newURL
  15.   put "Init Demo" && newDemo && newURL
  16.   if not stringp(newDemo) and not stringp(newURL) then
  17.     put "Demo Button initialized with no demo or URL!"
  18.     clear(me)
  19.   else
  20.     if launchButton > 0 then
  21.       set the visible of sprite launchButton to 1
  22.     end if
  23.     set currentDemo to newDemo
  24.     set currentURL to newURL
  25.   end if
  26. end
  27.  
  28. on TurnOn me
  29.   if stringp(currentDemo) and (currentDemo <> "-") then
  30.     set curplatform to the platform
  31.     if isMac() then
  32.       set path to currentDemo
  33.       set path to replace(path, "\", ":")
  34.     else
  35.       delpush("\")
  36.       set basepath to the moviePath
  37.       set path to item 1 of basepath & "\" & currentDemo
  38.       delpop()
  39.     end if
  40.     put path
  41.     open(path)
  42.   else
  43.     if stringp(currentURL) and (currentURL <> "-") then
  44.       if isMac() then
  45.         set currentURL to replace(currentURL, "\", ":")
  46.       else
  47.         set currentURL to replace(currentURL, ":", "\")
  48.       end if
  49.       put "Launching browser to URL:" && currentURL
  50.       launchBrowserUsingRefreshFile(the moviePath & currentURL)
  51.     end if
  52.   end if
  53. end
  54.  
  55. on TurnOff me
  56. end
  57.  
  58. on clear me
  59.   if launchButton > 0 then
  60.     set the visible of sprite launchButton to 0
  61.   end if
  62.   set currentDemo to 0
  63.   set currentURL to 0
  64. end
  65.  
  66. on dispose me
  67.   set currentDemo to 0
  68.   set currentURL to 0
  69.   set launchButton to 0
  70.   ClearObjectList(killList)
  71.   set killList to []
  72. end
  73.